import type { App } from "vue";
import * as icons from "@ant-design/icons-vue";

/**
 * 加载图标
 * @param app
 */
export function useIcon(app: App) {
  const allIcons: ObjectStr = icons;
  const useIcons: ObjectStr = {};

  Object.keys(allIcons).forEach(key => {
    //只加载线框风格图标
    if (key.indexOf("Outlined") != -1) {
      app.component(key, allIcons[key]);
      useIcons[`${key}`] = allIcons[key];
    }

    if (key == "CloseCircleFilled") {
      app.component(key, allIcons[key]);
    }
  });

  return useIcons;
}
